<%@page import="sdfi.lee.DAO.NoticeDAO"%>
<%@page import="sdfi.lee.Entity.Notice"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8" import="net.fckeditor.*"%>
<%@taglib prefix="FCK" uri="http://java.fckeditor.net"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>新闻添加</title>
<link rel="stylesheet" href="<c:url value='/css/adnews.css'></c:url>">
<script type="text/javascript" src="<c:url value='/js/jquery-1.6.js'></c:url>"></script>
<script type="text/javascript">
	$(function(){
		$('#yes').change(function(event){
			if($(this).is(':checked'))
				$(this).parent("div.items").next("div.items").show();
		});
		$('#no').change(function(event){
			if($(this).is(':checked'))
				$(this).parent("div.items").next("div.items").hide();
				$(this).parent("div.items").siblings("div:has(input[type=file])").remove();
			});
		$(':button').click(function(event){
			if($(this).val()=='+')
			{
				$(this).next(':button').attr('disabled',false);
				$(this).parent('div.items').after("<div class='items'><input type='file' name='files' /></div>");
				if($(this).parent('div.items').siblings("div:has(input[type=file])").size()=="5")
				$(this).attr("disabled",true);
			}
			else
			{	$(this).prev(':button').attr('disabled',false);
				$(this).parent('div.items').siblings('div:has(input[type=file]):last').remove();
				if($(this).parent('div.items').siblings("div:has(input[type=file])").size()=="1")
				$(this).attr("disabled",true);
			}
		});
		$('#no').click();
	});
</script>
</head>
<body>
<% 
	Notice notic=new NoticeDAO().getNoticeById(Integer.valueOf(request.getParameter("noticeid")));
	FCKeditor editor=new FCKeditor(request,"noticecontent");
	request.setAttribute("notice",notic);
	editor.setValue(notic.getNoticecontent());
	editor.setHeight("400px");
	editor.setWidth("600px");
%>
<div class="contain">
	<form action="<c:url value='/noticemf.action'></c:url>" method="post" enctype="multipart/form-data">
		<input type="hidden" value="${requestScope.notice.id}" name="id">
		<div class="items">
			<strong>公告标题：</strong><input class="text" type="text" name="noticetitle" value="${requestScope.notice.noticetitle }">
		</div>
		<div class="items">
			<strong>公告内容：</strong><!-- newscontent --><% out.println(editor); %>
		</div>
		<div class="items">
			<strong>修改附件：</strong><input type="radio" name="addpic" class="inputradio" id="yes">是 
					<input id="no" name="addpic" type="radio" class="inputradio" >否
		</div>
		<div class="items"><input type="button" value="+"/><input type="button" value="-" disabled="disabled" /></div>
		<div>
			<input type="submit" value="修改公告">
		</div>
	</form>
</div>
</body>
</html>